import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
import { downloadBlob } from '@/utils/file/download';
enum Api {
  SysVisLogApi = '/sysVisLog',
}
/**
 * 查询系统登录分页
 * @author frank
 * @date 2022-09-01 10:38:36
 */
export const getSysVisLogPage = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({ url: Api.SysVisLogApi + '/page', params });
/**
 * 导出系统登录
 * @author frank
 * @date 2022-09-01 10:38:36
 */
export const exportSysVisLog = (params?: any) => {
  return new Promise<void>((resolve, reject) => {
    defHttp
      .get(
        { responseType: 'blob', url: Api.SysVisLogApi + '/export', params },
        { isReturnNativeResponse: true },
      )
      .then((res) => {
        downloadBlob(res);
        resolve();
      })
      .catch(() => {
        reject();
      });
  });
};
